﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.ServiceModel;
using System.Text;
using MobileSales.Model.Tasks;
using MobileSales.Model.Exceptions;

namespace MobileSales.Server.Services
{
    [ServiceContract]
    public interface ITaskService
    {
        #region Schedule management
        [OperationContract]
        IEnumerable<Schedule> GetScheduleList(int employeeId);
        [OperationContract]
        Schedule GetSchedule(int scheduleId);
        [OperationContract]
        Schedule GetScheduleByDate(int employeeId, DateTime date);
        [OperationContract]
        [FaultContract(typeof(ValidationException))]
        void StoreSchedule(Schedule schedule);
        [OperationContract]
        [FaultContract(typeof(ValidationException))]
        void DeleteSchedule(int scheduleId);
        [OperationContract]
        [FaultContract(typeof(ValidationException))]
        void StartSchedule(int scheduleId, double? latitude, double? longitude);
        [OperationContract]
        [FaultContract(typeof(ValidationException))]
        void EndSchedule(int scheduleId, double? latitude, double? longitude);
        #endregion

        #region Task management
        [OperationContract]
        Task GetTask(int taskId);
        [OperationContract]
        CyclicTask GetCyclicTask(int taskId);
        [OperationContract]
        IEnumerable<Task> GetTaskList(int scheduleId);
        [OperationContract]
        IEnumerable<CyclicTask> GetCyclicTaskList(int employeeId);
        [OperationContract]
        [FaultContract(typeof(ValidationException))]
        void StoreTask(Task task, int employeeId);
        [OperationContract]
        [FaultContract(typeof(ValidationException))]
        void StoreCyclicTask(CyclicTask task);
        [OperationContract]
        [FaultContract(typeof(ValidationException))]
        void DeleteTask(int taskId);
        [OperationContract]
        [FaultContract(typeof(ValidationException))]
        void UpdateTaskStatus(int taskId, int taskStatus);
        [OperationContract]
        [FaultContract(typeof(ValidationException))]
        void StartTask(int taskId, int statusId, double? latitude, double? longitude);
        [OperationContract]
        [FaultContract(typeof(ValidationException))]
        void EndTask(int taskId, int statusId, double? latitude, double? longitude);
        #endregion

        #region Task status management
        [OperationContract]
        IEnumerable<TaskStatus> GetTaskStatusList();
        [OperationContract]
        TaskStatus GetTaskStatus(int taskStatusId);
        [OperationContract]
        [FaultContract(typeof(ValidationException))]
        void StoreTaskStatus(TaskStatus status);
        [OperationContract]
        [FaultContract(typeof(ValidationException))]
        void DeleteTaskStatus(int taskStatusId);
        #endregion

        #region Task type management
        [OperationContract]
        IEnumerable<TaskType> GetTaskTypeList();
        [OperationContract]
        TaskType GetTaskType(int taskTypeId);
        [OperationContract]
        [FaultContract(typeof(ValidationException))]
        void StoreTaskType(TaskType type);
        [OperationContract]
        [FaultContract(typeof(ValidationException))]
        void DeleteTaskType(int taskTypeId);
        #endregion
    }
}
